package com.chandra.pos.dao.impl;

import com.chandra.pos.dao.OrderStatusHistoryDAO;
import com.chandra.pos.dao.entity.OrderStatusEntity;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * UserEntity: chkumar
 * Date: 5/18/12
 * Time: 12:41 PM
 * To change this template use File | Settings | File Templates.
 */
@Repository

public class OrderStatusHistoryDAOImpl extends HibernateDaoSupport implements OrderStatusHistoryDAO {

    @Autowired
    public void setupSessionFactory(SessionFactory sessionFactory) {
        this.setSessionFactory(sessionFactory);
    }

    @Override
    public List<OrderStatusEntity> getOrderStatusHistory(long orderId) {

        List<OrderStatusEntity> items = this.getHibernateTemplate().findByNamedParam(
                "from  OrderStatusEntity "
                        + "where ORDER_ID = :ORDER_ID", "ORDER_ID", orderId);

        return items;
    }

    @Override
    public OrderStatusEntity saveOrderStatus(OrderStatusEntity orderStatusEntity) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }
}

